import type { App } from "vue";
import OlAnimationDrop from "./OlAnimationDrop.vue";
import OlAnimationFade from "./OlAnimationFade.vue";
import OlAnimationPath from "./OlAnimationPath.vue";
import OlAnimationShake from "./OlAnimationShake.vue";
import OlAnimationSlide from "./OlAnimationSlide.vue";
import OlAnimationTeleport from "./OlAnimationTeleport.vue";
import OlAnimationZoom from "./OlAnimationZoom.vue";
import type { Vue3OpenlayersGlobalOptions } from "@/types";
import { registerWithAliases } from "../registerWithAliases";

function install(app: App, options?: Vue3OpenlayersGlobalOptions) {
  registerWithAliases(app, "OlAnimationDrop", OlAnimationDrop);
  registerWithAliases(app, "OlAnimationFade", OlAnimationFade);
  registerWithAliases(app, "OlAnimationPath", OlAnimationPath);
  registerWithAliases(app, "OlAnimationShake", OlAnimationShake);
  registerWithAliases(app, "OlAnimationSlide", OlAnimationSlide);
  registerWithAliases(app, "OlAnimationTeleport", OlAnimationTeleport);
  registerWithAliases(app, "OlAnimationZoom", OlAnimationZoom);

  if (options) {
    app.provide("ol-options", options);
  }
}

declare module "@vue/runtime-core" {
  export function inject(key: "ol-options"): Vue3OpenlayersGlobalOptions;
}

export default install;

export {
  install,
  OlAnimationDrop,
  OlAnimationFade,
  OlAnimationPath,
  OlAnimationShake,
  OlAnimationSlide,
  OlAnimationTeleport,
  OlAnimationZoom,
};
